import request from "@/utils/request";

/**
 * @description 列表
 * @param params
 * @returns {*}
 */
export function getActivityList(params) {
    return request({
        url: '/activity/getActivityByBusiness',
        method: 'GET',
        params
    })
}

/**
 * @description 新增/编辑
 * @param data
 * @returns {*}
 */
export function save(data) {
    return request({
        url: '/activity/addAndUpdateActivity',
        method: 'POST',
        data
    })
}

/**
 * @description 删除
 * @param id
 * @returns {*}
 */
export function deleteRow(id) {
    return request({
        url: '/activity/delActivity',
        method: 'GET',
        params: {id}
    })
}

/**
 * @description 详情
 * @param id
 * @returns {*}
 */
export function detail(id) {
    return request({
        url: '/activity/getActivityDetail',
        method: 'GET',
        params: {id}
    })
}

export function getClassificationList(params) {
    return request({
        url: '/groupBuyingCategory/getListByActivityId',
        method: 'GET',
        params
    })
}

export function deleteClassificationRow(cid, type) {
    return request({
        url: '/groupBuyingCategory/delete',
        method: 'GET',
        params: {cid, type}
    })
}

export function saveClassification(data) {
    return request({
        url: '/groupBuyingCategory/admin/addAndUpdate',
        method: 'POST',
        data
    })
}

export function saveClassificationSon(data) {
    return request({
        url: '/classificationSubclass/addAndUpdate',
        method: 'POST',
        data
    })
}

export function deleteClassificationSonRow(id) {
    return request({
        url: '/classificationSubclass/deleteById',
        method: 'GET',
        params: {id}
    })
}

export function getClassificationDrop(businessId) {
    return request({
        url: '/groupBuyingCategory/applet/queryGroupBuyingCategory',
        method: 'GET',
        params: {businessId}
    })
}
